package com.wideplay.crosstalk.web;

import com.wideplay.warp.servlet.SessionScoped;
import net.jcip.annotations.NotThreadSafe;

/**
 * Tracks a logged-in user via the HTTP Session.
 *
 * @author Dhanji R. Prasanna (dhanji@gmail.com)
 */
@SessionScoped @NotThreadSafe
public class User {
    private String username;

    public String getUsername() {
        return username;
    }

    //logs in a user, by setting username to the current session
    public void login(String username) {
        this.username = username;
    }

    //logs out a user, by clearing username from session
    public void logout() {
        this.username = null;
    }
}
